{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#在Python中对于模块的加载是所谓的“一次加载”，也就是模块在程序调用中被修改也会重新加载原始的版本\n",
    "#test.py内容如下\n",
    "import some_lib\n",
    "x=5\n",
    "y=[1,2,3]\n",
    "result=some_lib.getanswer(x,y)\n",
    "#在运行该脚本后，some_lib的值发生了改变，当再次执行test.py,仍然会使用老版的some_lib\n",
    "\n",
    "#为了解决这个问题，可以通过reload加载,这样就能保证每次都是最新的模块\n",
    "import some_lib\n",
    "reload(some_lib)\n",
    "x=5\n",
    "y=[1,2,3]\n",
    "result=some_lib.getanswer(x,y)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
